<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="resources/css/sencha-touch.css" type="text/css">
</head>
<body>
    <script type="text/javascript" src="sencha-touch.js"></script>
    <script type="text/javascript">
        new Ext.Application({
            name: 'MyApp',

            profiles: {
               phone: function() { 
                   return Ext.is.Phone; // 是否是手机平台
               },
               tabletPortrait: function() {
                   return Ext.is.Tablet && Ext.orientation == 'portrait'; // 是否平板竖屏
               },
               tabletLandscape: function() {
                   return Ext.is.Tablet && Ext.orientation == 'landscape'; // 是否平板横屏
               }
            },

            launch: function() {
                this.viewport = new Ext.Panel({
                    fullscreen: true,

                    id: 'mainPanel',
                    layout: 'card',
                    items : [
                        {
                            html: 'Welcome to My App!'
                        },
                        {
                            html: 'Welcome to My App2!'
                        }
                    ]
                });
            }
        });

        setTimeout(function(){
            window.location.hash = 'aaa'
        }, 3000)

        var paramMatchingRegex = new RegExp(/:([0-9A-Za-z\_]*)/g);

        // ':target' 得到[':target']
        // ':target:target2' 得到[':target',':target2']
        var url = ':target:target2'
        
        // var paramsInMatchString = url.match(this.paramMatchingRegex) || [];

        // var cond = "[%a-zA-Z0-9\\_\\s,]+"

        // (表达式)   注：表达式默认[%a-zA-Z0-9\\_\\s,]+
        // var matcher = Ext.util.Format.format("({0})", cond || "[%a-zA-Z0-9\\_\\s,]+");

        // url = url.replace(new RegExp(':target'), '([%a-zA-Z0-9\\_\\s,]+)');

        // console.log(url.match(/^([%a-zA-Z0-9\_\s,]+)([%a-zA-Z0-9\_\s,]+)$/))

        console.log(new Ext.util.Route({
          url: ':controller/:action'
        }))

        console.log(new Ext.util.Route({
          url: ':controller/:action'
        }).recognize('target1/target2'))

        console.log(new Ext.util.Route({
          url: 'hash',
          controller: 'target3',
          action: 'target4'
        }))

        console.log(new Ext.util.Route(new Ext.util.Route({
          url: 'hash',
          controller: 'target3',
          action: 'target4'
        })).recognize('hash'))
    </script>
</body>
</html>